#include "SypEngine.h"

#ifdef CHECKMEM
#include "mmgr.h"
#endif
namespace Syp
{

Pass::Pass(const String& Name, const String& Description,PassType type):name(Name),description(Description),pt(type),sp(0)
{	
	PassRegistry::getRegistry().addPass(this);
}

String& Pass::getName()
{
	return name;
}

PassType Pass::getPassType()
{
	return pt;
}

void Pass::useShaderProgram(ShaderProgram* s)
{
	if(sp)
	{
		sp->removeInstance();
	}
	sp = s;
	sp->addInstance();
}

ShaderProgram* Pass::getShaderProgram()
{
	return sp;
}

Pass::~Pass()
{
	if(sp)
	{
		sp->removeInstance();
	}
}
}
